$(document).ready(function(){
    $("#Hotel_Service").addClass("active");
    $("#hotel_booking").addClass("active");
    var date = new Date();
    $("#room_book_create_time").val(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());
    $("#room_book_end_time").val(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());
});

// room_book_button
$(".room_book_button").click(function(){
    
    // get room id
    var roomId = this.getAttribute("form-data");
    $("#book_room_id").val(roomId);
    var elem_tr = document.getElementById("hotel_booking_room_tr_" + roomId);
    var obj = tr2obj(elem_tr);
    //modify booked room info
    modifyRoomInfo(obj);
    
    $("#default-title-1").click();
});

function modifyRoomInfo(obj){
    var roomCategory = document.getElementById("room_info_room_category");
    roomCategory.innerText = obj.room_category;
    var price = document.getElementById("room_info_price");
    price.innerText = obj.price;
    var deposit = document.getElementById("room_info_deposit");
    deposit.setAttribute("value", obj.price);
}